package com.sinosoft.system.primary.biz.imp;

import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.sinosoft.system.primary.biz.SysTokenBiz;
import com.sinosoft.system.primary.dao.SysTokenDao;
import com.sinosoft.system.primary.entity.SysToken;
import com.sinosoft.system.util.page.Pagenation;

@Service
@Transactional
public class SysTokenBizImp implements SysTokenBiz{

	private static Logger log = Logger.getLogger(SysTokenBizImp.class);
	
	@Autowired
	private SysTokenDao sysTokenDao;
	
	@Override
	public int insertSysToken(SysToken sysToken) {
		log.info("新增SysToken数据"+sysToken.toString());
		return sysTokenDao.insertSysToken(sysToken);
	}

	@Override
	public int updateSysToken(SysToken sysToken) {
		log.info("更新SysToken数据"+sysToken.toString());
		return sysTokenDao.updateSysToken(sysToken);
	}

	@Override
	public int deleteSysToken(int id) {
		log.info("删除SysToken数据 id="+id);
		return sysTokenDao.deleteSysToken(id);
	}

	@Override
	public SysToken selectSysToken(int id) {
		log.info("根据ID查询SysToken数据 id="+id);
		return sysTokenDao.selectSysToken(id);
	}

	@Override
	public SysToken selectSysToken(List<String> queryKeys,List<Object> queryValues) {
		log.info("查询SysToken数据 ");
		return sysTokenDao.selectSysToken(queryKeys, queryValues);
	}

	@Override
	public int selectCountSysToken() {
		log.info("查询SysToken数据 总数量");
		return sysTokenDao.selectCountSysToken();
	}

	@Override
	public int selectCountSysToken(List<String> queryKeys,List<Object> queryValues) {
		log.info("查询SysToken数据 总数量"+queryKeys.toString());
		return sysTokenDao.selectCountSysToken(queryKeys, queryValues);
	}

	@Override
	public List<SysToken> selectLimitSysToken(int start, int size) {
		log.info("查询SysToken数据 limit数量:start="+start+",size="+size);
		return sysTokenDao.selectLimitSysToken(start, size);
	}

	@Override
	public List<SysToken> selectLimitSysToken(List<String> queryKeys,List<Object> queryValues,int start, int size) {
		log.info("条件查询SysToken数据数量");
		return sysTokenDao.selectLimitSysToken(queryKeys, queryValues, start,  size);
	}

	@Override
	public List<SysToken> selectAllSysToken() {
		log.info("查询所有SysToken数据");
		return sysTokenDao.selectAllSysToken();
	}

	@Override
	public List<SysToken> selectAllSysToken(List<String> queryKeys,List<Object> queryValues) {
		log.info("条件查询所有SysToken数据");
		return sysTokenDao.selectAllSysToken(queryKeys, queryValues);
	}

	@Override
	public Pagenation selectPageSysToken(Pagenation page) {
		log.info("分页查询所有SysToken数据");
		int start =	page.getStartRow();
		int size = page.getPageSize();
		List<SysToken> rows = sysTokenDao.selectLimitSysToken(page.getQueryKeys(), page.getQueryValues(),start,size);
		int total = sysTokenDao.selectCountSysToken(page.getQueryKeys(), page.getQueryValues());
		page.setTotal(total);
		page.setRows(rows);
		return page;
	}

	public SysTokenDao getSysTokenDao() {
		return sysTokenDao;
	}

	public void setSysTokenDao(SysTokenDao sysTokenDao) {
		this.sysTokenDao = sysTokenDao;
	}

}
